package com.wondertek.mist.utils;


public class StringUtils {
		
	public static final String EMPTY = "";
	public static final int INDEX_NOT_FOUND = -1;


	public StringUtils() {
		super();
	}

	public static boolean isEmpty(String str) {
		return str == null || str.length() == 0;
	}

	
	public static boolean isNotEmpty(String str) {
		return !StringUtils.isEmpty(str);
	}

	
	public static String trimToEmpty(String str) {
		return str == null ? EMPTY : str.trim();
	}
	

	public static String nullToEmpty(String str) {
		if (StringUtils.isEmpty(str) || "null".equals(str)) { 
			return EMPTY;
		}
		return str;
	}
	
	
    public static boolean isBlank(String str) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if ((Character.isWhitespace(str.charAt(i)) == false)) {
                return false;
            }
        }
        return true;
    }
}
